'''
Author: duliang thinktanker@163.com
Date: 2024-06-24 20:49:42
LastEditors: duliang thinktanker@163.com
LastEditTime: 2024-06-24 23:45:21
FilePath: \sajj\soruce.py
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
'''
from hashlib import md5
import time


def jiami(row_id):
    """
    由小程序源代码获得构造函数
    将row_id 转换成 secret
    时间戳后三位转为000
    """
    timestamp = int(time.time()) * 1000
    timestamp = int(timestamp / 1000)
    M = time.localtime(timestamp).tm_mon
    D = time.localtime(timestamp).tm_mday
    return int(row_id) * M * D


def get_token(datalist):
    token = []
    for data in datalist:
        tmp = jiami(data["row_id"])
        token.append(str(tmp))
    return ','.join(token)


def get_secret(member_id, score):
    return md5(
        f"winyeahssajj@2021{member_id}{score}".encode('utf8')).hexdigest()


if __name__ == '__main__':
    # print(get_secret(member_id='80345', score=10))
    while 1:
        print(time.strftime('%S', time.localtime(time.time())))
        time.sleep(1)
